#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;

class Solution {
public:
    int minDays(int n)
    {
        if (n == 0)
            return 0;
        if (n == 1)
            return 1;
        return min(n % 3 + minDays(n / 3) + 1, n % 2 + minDays(n / 2) + 1);
    }
};